home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
glass
/
glass.lha
/
GLASS
/
glammar
/
ge23.c
< prev
next >
Wrap
C/C++ Source or Header
|
1991-01-21
|
3KB
|
113 lines
/*
This file is a part of the GLAMMAR source distribution
and therefore subjected to the copy notice below.
Copyright (C) 1989,1990 Eric Voss, ericv@cs.kun.nl
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation version 1
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "ge1.h"
#ifdef SET_ERRMSG
set_errmsg(ntname)
char *ntname;
{
if (rmax < level) {
strcpy(error_msg , ntname);
rmax = level;
}
}
#endif
#ifdef AFXCMP
#define GET_CELL_IN_STRING(cell,str)\
{ register char *d = (char *) & cell;\
register char *rc = str; \
d [0] = rc [1] ; d[1] = rc [2]; d [2] = rc [3];\
d[3] = rc[4];}
afxcmp(x,y)
register char * x, *y;
{
if ( (x == undefined) || (y == undefined)) {
if (rmax > 1)
fprintf(stderr, "==> %d :\n", rmax);
fprintf(stderr, "Glammar message:\n\
In afxcmp (\"%s\",\"%s\"): trying to evaluate uninstantiated affix.\n",
x,y);
parsecount = 0;
errmsg();
exit (1);
}
for (; *y != '\0'; )
if (*x == '\001' || *x == '\002') {
if (*x == *y)
if ((*(x+1) == *(y+1)) &&
(*(x+2) == *(y+2)) &&
(*(x+3) == *(y+3)) &&
(*(x+4) == *(y+4)) ) {
y +=6;
x +=6;
}
else if (( *x == '\001') &&
( *(x+5) == '\001') &&
( *(y+5) == '\001') ) {
affix *ax,*ay;
GET_CELL_IN_STRING(ax,x);
GET_CELL_IN_STRING(ay,y);
if (dequal(ax->l,ay ->l) &&
dequal(ax->r,ay ->r)) {
y +=6;
x +=6;
} else return 1;
}
else return 1;
else return 1;
}
else if (*x++ != *y++)
return 1;
if (*x == '\0')
return 0;
return 1;
}
lexafxcmp(x,y)
register char * x, *y;
{
for (; *y != '\0'; )
if (*x == '\001' || *x == '\002') {
if (*x == *y)
if (*(x+1) == *(y+1))
if (*(x+2) == *(y+2))
if (*(x+3) == *(y+3))
if (*(x+4) == *(y+4) ){
y +=6;
x +=6;
}
else return *(x+4) - *(y+4);
else return *(x+3) - *(y+3);
else return *(x+2) - *(y+2);
else return *(x+1) - *(y+1);
else return *x - *y;
}
else if (*x++ != *y++)
return *(x-1) - *(y-1);
return *x;
}
#endif